/* 添加主容器样式 */
.main-container {
  display: flex;
  height: 100vh;
  background: #f8fafc;
}

/* 侧边栏样式 */
.history-sidebar {
  width: 300px;
  border-right: 1px solid #e2e8f0;
  background: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-header {
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 16px;
}

.history-tab {
  padding: 8px 16px;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 14px;
}

.history-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.history-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.history-item {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-item-title {
  font-size: 14px;
  color: #0f172a;
}

.history-item-time {
  font-size: 12px;
  color: #94a3b8;
}

/* 修改现有的编辑器容器样式 */
.editor-container {
  position: relative;
  flex: 1;
  border-radius: 0;
  border: 0;
  border-left: 1px solid #e2e8f0;
  width: calc(100vw - 300px);
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #ffffff;
  z-index: 1;
}

.editor-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  /* 修改这行 */
  background: white;
  min-height: 0;
  position: relative;
  /* 添加相对定位 */
}

.ProseMirror h1 {
  font-size: 2em;
  margin: 1em 0 0.5em;
}

.ProseMirror h2 {
  font-size: 1.5em;
  margin: 1em 0 0.5em;
}

.ProseMirror h3 {
  font-size: 1.25em;
  margin: 1em 0 0.5em;
}

.ProseMirror blockquote {
  border-left: 3px solid #e2e8f0;
  margin: 1em 0;
  padding-left: 1em;
  color: #64748b;
}

.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.ProseMirror code {
  background: #f1f5f9;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.ProseMirror hr {
  border: none;
  border-top: 2px solid #e2e8f0;
  margin: 2em 0;
}

.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #94a3b8;
  pointer-events: none;
  height: 0;
}

/* 表格样式 */
.editor-content table {
  border-collapse: collapse;
  margin: 0;
  overflow: hidden;
  table-layout: fixed;
  width: 100%;
}

.editor-content table td,
.editor-content table th {
  border: 2px solid #ced4da;
  box-sizing: border-box;
  min-width: 1em;
  padding: 0.5rem 1rem;
  position: relative;
  vertical-align: top;
}

.editor-content table th {
  background-color: #f8f9fa;
  font-weight: bold;
}

.editor-content table td>*,
.editor-content table th>* {
  margin-bottom: 0;
}

/* 表格调整大小时的样式 */
.editor-content .resize-cursor {
  cursor: col-resize;
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: #0d6efd;
  opacity: 0;
  transition: opacity 0.3s;
}

.editor-content .resize-cursor:hover {
  opacity: 1;
}

/* 选中单元格的样式 */
.editor-content table td.selected,
.editor-content table th.selected {
  background-color: rgba(200, 200, 255, 0.2);
}

/* 表格hover效果 */
.editor-content table td:hover,
.editor-content table th:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  padding: 8px;
  border-bottom: 1px solid #eee;
  background: #fff;
  position: relative;
  z-index: 999;
  top: 0;
  gap: 4px;
}

.editor-title {
  padding: 16px 24px;
  border-bottom: 1px solid #e0e0e0;
}

.title-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 28px;
  font-weight: 500;
  color: #333;
  padding: 0;
}

.title-input::placeholder {
  color: #999;
}

.toolbar-select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  margin: 0 4px;
  font-size: 14px;
  height: 32px;
  cursor: pointer;
}

.toolbar-select:hover {
  border-color: #bbb;
}

.toolbar-select:focus {
  outline: none;
  border-color: #4a9eff;
}

.custom-text-style {
  font-size: inherit;
}

.find-replace-panel {
  position: absolute;
  width: 300px;
  padding: 10px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.find-replace-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.find-replace-row:last-child {
  margin-bottom: 0;
}

.find-replace-row input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.find-replace-row button {
  padding: 4px 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.find-replace-row button:hover {
  background: #f0f0f0;
}

/* 标题样式 */
.editor-heading.h1 {
  font-size: 2em;
  font-weight: bold;
  margin: 1em 0 0.5em;
}

.editor-heading.h2 {
  font-size: 1.5em;
  font-weight: bold;
  margin: 0.83em 0;
}

.editor-heading.h3 {
  font-size: 1.17em;
  font-weight: bold;
  margin: 1em 0;
}

.editor-heading.h4 {
  font-size: 1em;
  font-weight: bold;
  margin: 1.33em 0;
}

.toolbar-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 4px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.toolbar-button:hover {
  background: #f5f5f5;
}

.toolbar-button.is-active {
  background: #e8f0fe;
  border-color: #4285f4;
  color: #4285f4;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: #e0e0e0;
  margin: 0 4px;
}

/* 字体和字号选择器样式 */
.font-select {
  min-width: 120px;
  height: 32px;
  padding: 4px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  margin-right: 4px;
}

/* 颜色选择器样式 */
.color-picker {
  position: relative;
}

.color-picker-popup {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  padding: 8px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 格式刷按钮样式 */
.format-painter {
  position: relative;
}

.format-painter.is-active .toolbar-button {
  background: #e8f0fe;
  border-color: #4285f4;
}

/* 导出按钮样式 */
.export-button {
  margin-left: auto;
}

/* 图标样式 */
.icon {
  font-style: normal;
  font-size: 16px;
  line-height: 1;
}

.color-picker-container {
  position: relative;
  display: inline-block;
}

.color-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  font-size: 12px;
  color: white;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
}

.color-picker-dropdown {
  position: absolute;
  top: 0;
  left: 100%; 
  margin-left: 4px;
  margin-top: 0;
  z-index: 1000;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 8px;
}

.color-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-row {
  display: flex;
  gap: 4px;
}

.color-cell {
  width: 20px;
  height: 20px;
  border: 1px solid #ccc;
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
}

.color-cell:hover {
  border-color: #000;
}

.color-picker-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.more-colors {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  border-radius: 4px;
}

.more-colors:hover {
  background: #f5f5f5;
}

.more-colors-icon {
  font-size: 14px;
  margin-right: 4px;
}

/* 添加自定义颜色选择器样式 */
.custom-color-picker {
  position: absolute;
  top: 0; 
  left: calc(100% + 220px);
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 12px;
  width: 220px;
}

.custom-color-header {
  margin-bottom: 8px;
  font-size: 14px;
  color: #333;
}

.color-input-container {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.color-preview {
  width: 40px;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.color-input {
  flex: 1;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.color-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.color-action-button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 12px;
}

.color-action-button.primary {
  background: #4285f4;
  color: white;
  border-color: #4285f4;
}

.color-action-button:hover {
  background: #f5f5f5;
}

.color-action-button.primary:hover {
  background: #3b78e7;
}

/* 添加用户名显示样式 */
.ProseMirror {
  flex: 1;
  padding: 20px;
  background: #ffffff;
  overflow-y: auto;
  height: calc(100vh - 160px);
  outline: none;
}

.cursor-tooltip {
  position: fixed;
  background-color: #4285f4;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%, -100%);
  box-shadow: 0 2px 6px rgba(66, 133, 244, 0.3);
  transition: all 0.2s ease;
  z-index: 1000;
  margin-top: -8px;
  /* 添加上边距 */
  margin-left: 4px;
  /* 添加左边距 */
}

.cursor-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: #4285f4 transparent transparent transparent;
}

.cursor-tooltip.show {
  opacity: 1;
  transform: translate(8px, -24px);
}

.cursor-tooltip.hide {
  opacity: 0;
  transform: translate(8px, -20px);
}


.editor-status {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #f8f9fa;
  border-top: 1px solid #e2e8f0;
}

.connection-status {
  margin-right: 16px;
  color: #64748b;
  font-size: 14px;
}

.online-users {
  color: #4285f4;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.online-users::before {
  content: "•";
  color: #34a853;
  font-size: 18px;
}

/* 替换按钮 */
.find-replace-container {
  position: relative;
}